From: Carlos Garnacho Date: Tue, 22 Jul 2014 10:50:54 +0000 (+0200) Subject: grabHelper: consume the press/motion/release sequence if a press dismisses the grab X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2294 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=bbfa616f275cdd41c052682f79f8e997f160c99c;p=gnome-shell.git grabHelper: consume the press/motion/release sequence if a press dismisses the grab The grab would previously just consume the button release, while propagating motion events, possibly down to clients in wayland. This would produce inconsistent streams there. On pointer events, the inconsistency would just be having clients receiving events with the button 1 set in the mask, with no implicit grab. When touch events are handled, this would be more hindering as the client would receive touch_motion events with no prior touch_down nor later touch_up, something never supposed to happen. https://bugzilla.gnome.org/show_bug.cgi?id=733633 --- diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js index ec53deb90..c5f76c8cf 100644 --- a/js/ui/grabHelper.js +++ b/js/ui/grabHelper.js @@ -283,12 +283,14 @@ const GrabHelper = new Lang.Class({ return Clutter.EVENT_STOP; } + let motion = type == Clutter.EventType.MOTION; let press = type == Clutter.EventType.BUTTON_PRESS; let release = type == Clutter.EventType.BUTTON_RELEASE; let button = press || release; - if (release && this._ignoreRelease) { - this._ignoreRelease = false; + if (this._ignoreUntilRelease && (motion || release)) { + if (release) + this._ignoreUntilRelease = false; return Clutter.EVENT_STOP; } @@ -299,10 +301,11 @@ const GrabHelper = new Lang.Class({ return Clutter.EVENT_PROPAGATE; if (button) { - // If we have a press event, ignore the next event, - // which should be a release event. + // If we have a press event, ignore the next + // motion/release events. if (press) - this._ignoreRelease = true; + this._ignoreUntilRelease = true; + let i = this._actorInGrabStack(event.get_source()) + 1; this.ungrab({ actor: this._grabStack[i].actor, isUser: true }); return Clutter.EVENT_STOP;